<template>
  <el-dialog
    :visible.sync="dialogVisible"
    width="640px"
    :before-close="handleClose"
  >
    <div class="dialogBox">
      <div class="left">
        <div class="title">全景图</div>
        <div style="margin-bottom: 20px">
          <img :src="`/httpImage/${data[index].list[0].picMaxUrl[0]}`" />
        </div>
        <el-descriptions :title="data[index].list[0].likeDate" :column="1">
          <el-descriptions-item label="设备名称">{{
            data[index].activeObject.cameraName
              ? data[index].activeObject.cameraName
              : ""
          }}</el-descriptions-item>
          <el-descriptions-item label="出现小区">{{
            data[index].activeObject.cameraAddr.split("/")[0]
          }}</el-descriptions-item>
          <el-descriptions-item label="所属派出所">{{
            data[index].activeObject.cameraAddr.split("/")[1] || "-"
          }}</el-descriptions-item>
        </el-descriptions>
      </div>
      <div class="right">
        <div class="title">抓拍图</div>
        <div class="imgBox">
          <div class="box1">
            <img
              :src="`/httpImage/${data[index].activeObject.targetInfo[0].picSmUrl}`"
            />
          </div>
          <div class="box1">
            <img
              :src="`/httpImage/${data[index].activeObject.baseInfo[0].targetPicUrl}`"
            />
          </div>
          <div class="num">
            <span>100%</span>
          </div>
        </div>
        <el-descriptions title="对比信息" :column="1">
          <el-descriptions-item label="底库">{{
            data[index].activeObject.baseInfo[0].tableName
          }}</el-descriptions-item>
          <el-descriptions-item label="姓名">{{
            data[index].activeObject.baseInfo[0].targetName
          }}</el-descriptions-item>
          <el-descriptions-item label="性别">{{
            JSON.parse(data[index].activeObject.baseInfo[0].labels).sex
          }}</el-descriptions-item>
          <el-descriptions-item label="身份证号">{{
            JSON.parse(data[index].activeObject.baseInfo[0].labels).idCard
          }}</el-descriptions-item>
          <el-descriptions-item label="手机号">{{
            JSON.parse(data[index].activeObject.baseInfo[0].labels).phone
          }}</el-descriptions-item>
          <el-descriptions-item label="重要等级">{{
            data[index].activeObject.baseInfo[0].monitorLevel
          }}</el-descriptions-item>
        </el-descriptions>
      </div>
    </div>
    <span slot="footer">
      <el-button @click="dialogVisible = false" class="darkBtn"
        >关 闭</el-button
      >
      <el-button class="darkBtn" @click="pre" :disabled="index === 0"
        >上一个</el-button
      >
      <el-button
        class="darkBtn"
        @click="next"
        :disabled="index === data.length - 1"
        >下一个</el-button
      >
    </span>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      data: [],
      index: 0,
      panoramaImgUrl: "",
      rightImgUrl: "",
      leftImgUrl: "",
      isImgComparison: false,
    };
  },
  methods: {
    handleClose() {
      this.dialogVisible = false;
    },
    next() {
      this.index = this.index + 1;
    },
    pre() {
      this.index = this.index - 1;
    },
    add(data, index) {
      console.log(data[index]);
      this.data = data;
      this.index = index;
      this.dialogVisible = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.dialogBox {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
  align-items: flex-start;
  .title {
    color: #fff;
    font-size: 14px;
    margin-bottom: 20px;
  }
  .left {
    width: 350px;
    img {
      width: 350px;
      object-fit: cover;
    }
    p {
      margin: 4px 0px;
    }
  }
  .right {
    width: 230px;
    .imgBox {
      display: flex;
      width: 100%;
      position: relative;
      flex-direction: row;
      justify-content: space-between;
      .box1 {
        width: calc(50% - 4px);
      }
      position: relative;
    }
    img {
      width: 100%;
      height: 100px;
      object-fit: cover;
    }
    .num {
      padding: 4px 8px;
      font-size: 14px;
      color: white;
      position: absolute;
      border-radius: 4px;
      bottom: 0px;
      background: $color-success;
      display: inline-block;
      width: 56px;
      left: calc(50% - 35px);
      bottom: -5px;
    }
  }
}
.el-dialog__header {
  padding: 0 20px;
  background: #0a1a34;
  padding-top: 16px;
  border-bottom: 0px solid #e5e5e5;

  .el-dialog__title {
    color: #fff;
  }
}

.el-dialog__headerbtn {
  display: none;
}

::v-deep .el-dialog__body {
  background: #0a1a34;
  width: 640px !important;
  color: #fff;
}

.el-dialog__footer {
  background-color: #0a1a34;
  text-align: right;
  padding-right: 20px;
  box-sizing: border-box;
}
::v-deep .el-descriptions {
  color: #fff;
}
::v-deep .el-descriptions__body {
  background-color: transparent !important;
  color: #fff;
}
</style>
